****************************************************************************************************************************************
* Reproduction file for "The globalisation divide in the public mind: Belief systems on globalisation and their electoral consequences *
****************************************************************************************************************************************

* This do file reproduces all results for the GLES campaing panel reported in the APPENDIX
* Run GLES_01_clean_data.do before


********* Appendix section A4: Additional indicators of “non-attitudes” toward globalisation *********

*** Figure A2, left panel: Globalization attitudes bar plot, all 3 waves
	use "DATA_stata.dta", clear
	keep lfdn globw3 globw8 globw9
	reshape long globw, i(lfdn) j(wave)
	
	catplot wave globw, percent(wave) recast(bar) asyvars ylabel(, ang(h)) bar(1, bcolor(gs4)) bar(2, bcolor(gs8)) bar(3, bcolor(gs12)) ///
	yscale(range(0 60)) ylabel(0 (10) 60) ///
	scheme(plotplainblind) title("By and large, globalisation is a good thing.", size(large)) ytitle("Percent", size(large)) ylabel(,labsize(large)) ///
	name(g_long, replace) legend(size(large) title("Wave", size(large)) position(2)  ring(0))

*** Figure A2, right panel: Globalization attitude bar plot, by political awareness
	use "DATA_stata.dta", clear
	catplot pawa_d globw3, percent(pawa_d) recast(bar) asyvars ylabel(, ang(h)) bar(1, bcolor(gs4)) bar(2, bcolor(gs8)) bar(3, bcolor(gs12)) ///
	yscale(range(0 60)) ylabel(0 (10) 60) ///
	scheme(plotplainblind) title("By political awareness (wave 3)", size(large)) ylabel(,labsize(large)) ///
	name(g1, replace) legend(size(large)  title("Political" "awareness", size(large)) position(2)  ring(0))
	
	* Combine graphs to Figure A2	
	graph combine g_long g1, rows(1) imargin(vsmall) iscale(*1.2) xsize(10)
	graph export FigureA2.pdf, replace

********* Appendix section A5: A closer look at globalisation attitude stability *********
	
*** Appendix A5: Stability of globalization attitudes and voting norm, by political awareness
	use "DATA_stata.dta", clear
	recode globadiff83 globadiff98 globadiff93 globadiff983 vnormadiff85 vnormadiff98 vnormadiff95 vnormadiff985 (3 4 5 6 7 8 = 3) // code "3 scale points or more" category
	*ssc install tab_chi // tabm command is part of the tab_chi ado package
	tabm globadiff83 globadiff98 globadiff93 globadiff983 vnormadiff85 vnormadiff98 vnormadiff95 vnormadiff985 if pawa_d == 0, column nof transpose 
	tabm globadiff83 globadiff98 globadiff93 globadiff983 vnormadiff85 vnormadiff98 vnormadiff95 vnormadiff985 if pawa_d == 1, column nof transpose 
	

********* Appendix section A6: Pairwise correlations between issue items *********

*** Table A 6: Pairwise Pearson correlations between issue items
	use "DATA_stata.dta", clear
	pwcorr globw3x globw8x globw9x ecoopen1x ecoopen2x ecoopen3x europe1x europe2x europe3x immi1x immi2x immi3x redis1x redis2x redis3x civlib1x civlib2x cultlib1x
	
	
********* Appendix section A7: Pairwise correlations between additive indices *********

*** Table A 7: Pairwise Pearson correlations between additive indices
	use "DATA_stata.dta", clear
	pwcorr glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x, sig
	
	
********* Appendix section A8: Explaining attitudes towards globalisation issues and globalisation *********

*** Table A 8: Determinants of globalisation (issue) attitudes
	use "DATA_stata.dta", clear
	foreach var in ecoopen_i europe_i immi_i glob_i {
	reg `var' selftran_c cons_c ecsit_ego1 ecsit_soc1
	estimates store psy_`var'1
	}
	reg glob_i selftran_c cons_c ecsit_ego ecsit_soc ecoopen_i europe_i immi_i
	estimates store psy_glob_i2

	esttab psy_ecoopen_i1 psy_europe_i1 psy_immi_i1 psy_glob_i1 psy_glob_i2 ///
	using TableA8.rtf, b(%8.2f) se(%8.2f) star(* 0.05 ** 0.01 *** 0.001) ar2 varwidth(20) nogaps compress ///
	coeflabels(	selftran_c "Self-transcendence" ///
				cons_c "Conservation" ///
				ecsit_ego1 "Economic situation (ego)" ///
				ecsit_soc1 "Economic situation (country)" ///
				ecoopen_i "Economic openness" ///
			    europe_i "European integration" ///
			    immi_i "Immigration" ///
			    _cons "Constant") ///
	mtitles("Economic openness" "European integration" "Immigration" "Globalisation") nonumbers replace ///
	addnotes("Notes: Reported are unstandardized OLS coefficients with standard errors in parentheses; IVs and DVs range from 0 to 1.")
		
*** Table A 9: Determinants of old policy issue attitudes
	use "DATA_stata.dta", clear
	foreach var in redis_i civlib_i cultlib1x {
	reg `var' selftran_c cons_c ecsit_ego ecsit_soc // ib8.kp3_pi ib0.ecthreat
	quietly eststo psy_`var'
	}
	esttab psy_redis_i psy_civlib_i psy_cultlib1x  ///
	using TableA9.rtf, wide b(%8.2f) se(%8.2f) star(* 0.05 ** 0.01 *** 0.001) ar2 varwidth(20) nogaps compress ///
	coeflabels(	selftran_c "Self-transcendence" ///
				cons_c "Conservation" ///
				ecsit_ego1 "Economic situation (ego)" ///
				ecsit_soc1 "Economic situation (country)" ///
				ecoopen_i "Economic openness" ///
			    europe_i "European integration" ///
			    immi_i "Immigration" ///
			    _cons "Constant") ///
	mtitles("Redistribution" "Civil liberties" "Cultural liberties") nonumbers replace ///
	addnotes("Notes: Reported are unstandardized OLS coefficients with standard errors in parentheses; IVs and DVs range from 0 to 1.")

	
********* Appendix section A9: Additional results for vote choice and party approval models *********

	* Listwise deletion for the two models; keep observations constant
	use "DATA_stata.dta", clear
	global controls "ib8.pi c.age_indec##c.age_indec i.female i.educat i.incomecat i.east ecsit_ego1 ecsit_soc1"
	quietly reg vote glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x $controls 
	keep if e(sample)

*** Table A 10: Full regression table for model 1 of Figure 2 in the article
	mlogit vote glob_i redis_i civlib_i cultlib1x $controls
		estimate store m1

		esttab m1 ///
		using TableA10.rtf, b(%8.2f) se(%8.2f) star(* 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
		unstack noomitted ///
		drop(8.pi 1.incomecat 1.educat 0.female 0.east) /// 
		coeflabels(glob_i "Globalisation" ///
				   redis_i "Redistribution" ///
				   civlib_i "Civil liberties" ///
				   cultlib1x "Cult. liberalism" ///
					1.pi "PI: CDU/CSU" ///
					2.pi "PI: FDP" ///
					3.pi "PI: SPD" ///
					4.pi "PI: Greens" ///
					5.pi "PI: The Left" ///
					6.pi "PI: AfD" ///
					7.pi "PI: Other party" ///
					age_indec "Age" ///
					c.age_indec#c.age_indec "Age squared" ///
					2.incomecat "Income: 1000-2000" ///
					3.incomecat "Income: 2000-3000" ///
					4.incomecat "Income: 3000-4000" ///
					5.incomecat "Income: >4000" ///
					1.female "Female" ///
					2.educat "Education: medium" ///
					3.educat "Education: high" ///
					1.east "Eastern Germany" ///
					ecsit_ego1 "Economic situation (ego)" ///
					ecsit_soc1 "Economic situation (country)" ///
					_cons "Constant") ///
		nonumbers replace ///
		addnotes("Notes: Reported are coefficients from multinomial logit with standard errors in parentheses; baseline outcome category is CDU/CSU; all IVs range from 0 to 1; reference category for party identity dummies is 'no PI'")
	
*** Table A 11: Full regression table for model 2 of Figure 2 in the article
	mlogit vote glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x $controls
		estimate store m2
		
		esttab m2 ///
		using TableA11.rtf, b(%8.2f) se(%8.2f) star(* 0.05 ** 0.01 *** 0.001) varwidth(20) nogaps compress ///
		unstack noomitted ///
		drop(8.pi 1.incomecat 1.educat 0.female 0.east) /// 
		coeflabels(glob_i "Globalisation" ///
				   ecoopen_i "Econ. openness" ///
				   europe_i "Europ. integr." ///
				   immi_i "Immigration" ///
				   redis_i "Redistribution" ///
				   civlib_i "Civil liberties" ///
				   cultlib1x "Cult. liberalism" ///
					1.pi "PI: CDU/CSU" ///
					2.pi "PI: FDP" ///
					3.pi "PI: SPD" ///
					4.pi "PI: Greens" ///
					5.pi "PI: The Left" ///
					6.pi "PI: AfD" ///
					7.pi "PI: Other party" ///
					age_indec "Age" ///
					c.age_indec#c.age_indec "Age squared" ///
					2.incomecat "Income: 1000-2000" ///
					3.incomecat "Income: 2000-3000" ///
					4.incomecat "Income: 3000-4000" ///
					5.incomecat "Income: >4000" ///
					1.female "Female" ///
					2.educat "Education: medium" ///
					3.educat "Education: high" ///
					1.east "Eastern Germany" ///
					ecsit_ego1 "Economic situation (ego)" ///
					ecsit_soc1 "Economic situation (country)" ///
					_cons "Constant") ///
		nonumbers replace ///
		addnotes("Notes: Reported are coefficients from multinomial logit with standard errors in parentheses; baseline outcome category is CDU/CSU; all IVs range from 0 to 1; reference category for party identity dummies is 'no PI'")
	
*** Figure A 3: Effects of attitudes towards globalisation and globalisation issues on vote choice – party leader approval included as additional control
	use "DATA_stata.dta", clear
	
	* Listwise deletion for the two models; keep observations constant
	global controls "ib8.pi c.age_indec##c.age_indec i.female i.educat i.incomecat i.east ecsit_ego1 ecsit_soc1 merkel1 seeh1 lindner1 schulz2 goeeck1 wagenk2 petry1"
	quietly reg vote glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x $controls
	keep if e(sample)
		
	* Model 1: Only Globalisation attitudes
	mlogit vote glob_i redis_i civlib_i cultlib1x $controls
	estimate store m1
	
			forvalues p = 1/8 {
			estimate restore m1
			margins, dydx(glob_i redis_i civlib_i cultlib1x) predict(outcome(`p')) post
			estimate store marg_A`p'
			}
			
			coefplot marg_A1 || marg_A2 || marg_A3 || marg_A4 || marg_A5 || marg_A6 || marg_A7 || marg_A8, scheme(plotplainblind) ///
				coeflabels(glob_i = "Globalisation" redis_i = "Redistribution" civlib_i = "Civil liberties" cultlib1x = "Cultural liberalism") ///
				order(glob_i ecoopen_i europe_i immi_i) ///
				xline(0, lcolor(gs0) lwidth(thin)) xscale(range(-.4 .4)) xlabel(-.4  (.2) .4) bylabels("CDU/CSU" "FDP" "SPD" "Greens" "Left" "AfD" "Other party" "Did not vote") ///
				byopts(row(2) title("Model 1: Globalisation attitude only, without attitudes towards globalisation issues"))  ///
				fysize(40) ///
				name(AMEs_vote_onlyglob, replace) 		

	* Model 2: Attitudes towards Globalisation and Globalisation issues
	mlogit vote glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x $controls
	estimate store m2
	
		forvalues p = 1/8 {
		estimate restore m2
		margins, dydx(glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x) predict(outcome(`p')) post
		estimate store marg_C`p'
		}
				
		coefplot marg_C1 || marg_C2 || marg_C3 || marg_C4 || marg_C5 || marg_C6 || marg_C7 || marg_C8, scheme(plotplainblind) ///
			coeflabels(glob_i ="Globalisation" europe_i ="European integration" immi_i = "Immigration" ecoopen_i = "Economic openness" redis_i = "Redistribution" civlib_i = "Civil liberties" cultlib1x = "Cultural liberalism") ///
			order(glob_i ecoopen_i europe_i immi_i) ///
			xline(0, lcolor(gs0) lwidth(thin)) xscale(range(-.4 .4)) xlabel(-.4  (.2) .4) bylabels("CDU/CSU" "FDP" "SPD" "Greens" "Left" "AfD" "Other party" "Did not vote") ///
			byopts(row(2)title("Model 2: Full model, including attitudes towards globalisation issues")) ///
			fysize(50) ///
			name(AMEs_vote_both, replace) 	
		
	* Combine graphs to Figure A 3	
	graph combine AMEs_vote_onlyglob AMEs_vote_both, rows(2) xsize(6.5) iscale(*1.5) imargin(vsmall)
	graph export FigureA3.pdf, replace
	
	
*** Figure A 4: Effects of attitudes towards globalisation and globalisation issues on vote choice – party identification excluded
	use "DATA_stata.dta", clear
	
	* Listwise deletion for the two models; keep observations constant
	global controls "c.age_indec##c.age_indec i.female i.educat i.incomecat i.east ecsit_ego1 ecsit_soc1"
	quietly reg vote glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x $controls
	keep if e(sample)
		
	* Model 1: Only Globalisation attitudes
	mlogit vote glob_i redis_i civlib_i cultlib1x $controls
	estimate store m1
	
			forvalues p = 1/8 {
			estimate restore m1
			margins, dydx(glob_i redis_i civlib_i cultlib1x) predict(outcome(`p')) post
			estimate store marg_A`p'
			}
			
			coefplot marg_A1 || marg_A2 || marg_A3 || marg_A4 || marg_A5 || marg_A6 || marg_A7 || marg_A8, scheme(plotplainblind) ///
				coeflabels(glob_i = "Globalisation" redis_i = "Redistribution" civlib_i = "Civil liberties" cultlib1x = "Cultural liberalism") ///
				order(glob_i ecoopen_i europe_i immi_i) ///
				xline(0, lcolor(gs0) lwidth(thin)) xscale(range(-.4 .4)) xlabel(-.4  (.2) .4) bylabels("CDU/CSU" "FDP" "SPD" "Greens" "Left" "AfD" "Other party" "Did not vote") ///
				byopts(row(2) title("Model 1: Globalisation attitude only, without attitudes towards globalisation issues"))  ///
				fysize(40) ///
				name(AMEs_vote_onlyglob, replace) 		
	
	* Model 2: Attitudes towards Globalisation and Globalisation issues
	mlogit vote glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x $controls
	estimate store m2
	
		forvalues p = 1/8 {
		estimate restore m2
		margins, dydx(glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x) predict(outcome(`p')) post
		estimate store marg_C`p'
		}
				
		coefplot marg_C1 || marg_C2 || marg_C3 || marg_C4 || marg_C5 || marg_C6 || marg_C7 || marg_C8, scheme(plotplainblind) ///
			coeflabels(glob_i ="Globalisation" europe_i ="European integration" immi_i = "Immigration" ecoopen_i = "Economic openness" redis_i = "Redistribution" civlib_i = "Civil liberties" cultlib1x = "Cultural liberalism") ///
			order(glob_i ecoopen_i europe_i immi_i) ///
			xline(0, lcolor(gs0) lwidth(thin)) xscale(range(-.4 .4)) xlabel(-.4  (.2) .4) bylabels("CDU/CSU" "FDP" "SPD" "Greens" "Left" "AfD" "Other party" "Did not vote") ///
			byopts(row(2)title("Model 2: Full model, including attitudes towards globalisation issues")) ///
			fysize(50) ///
			name(AMEs_vote_both, replace) 	
		
	* Combine graphs	
	graph combine AMEs_vote_onlyglob AMEs_vote_both, rows(3) xsize(6.5) iscale(*1.5) imargin(vsmall)
	graph export FigureA4.pdf, replace
	
*** Figure A 5: Effects of attitudes towards globalisation and globalisation issues on voting intentions (wave 9)
	use "DATA_stata.dta", clear	
	
	* Listwise deletion for the two models; keep observations constant
	global controls "ib8.pi c.age_indec##c.age_indec i.female i.educat i.incomecat i.east ecsit_ego1 ecsit_soc1"
	quietly reg vote glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x $controls 
	keep if e(sample)

	* Model 1: Only Globalisation attitudes
	mlogit vi glob_i redis_i civlib_i cultlib1x $controls
	estimate store m1
	
			forvalues p = 1/9 {
			estimate restore m1
			margins, dydx(glob_i redis_i civlib_i cultlib1x) predict(outcome(`p')) post
			estimate store marg_A`p'
			}
			
			coefplot marg_A1 || marg_A2 || marg_A3 || marg_A4 || marg_A5 || marg_A6 || marg_A7 || marg_A8 || marg_A9, scheme(plotplainblind) ///
				coeflabels(glob_i = "Globalisation" redis_i = "Redistribution" civlib_i = "Civil liberties" cultlib1x = "Cultural liberalism") ///
				order(glob_i ecoopen_i europe_i immi_i) ///
				xline(0, lcolor(gs0) lwidth(thin)) xscale(range(-.4 .4)) xlabel(-.4  (.2) .4) bylabels("CDU/CSU" "FDP" "SPD" "Greens" "Left" "AfD" "Other party" "Don't know" "Will not vote") ///
				byopts(row(3) title("Model 1: Globalisation attitude only, without attitudes towards globalisation issues"))  ///
				fysize(40) ///
				name(AMEs_vote_onlyglob, replace) 		
	
	* Model 3: Attitudes towards Globalisation and Globalisation issues
	mlogit vi glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x $controls
	estimate store m2
	
		forvalues p = 1/9 {
		estimate restore m2
		margins, dydx(glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x) predict(outcome(`p')) post
		estimate store marg_C`p'
		}
				
		coefplot marg_C1 || marg_C2 || marg_C3 || marg_C4 || marg_C5 || marg_C6 || marg_C7 || marg_C8 || marg_C9, scheme(plotplainblind) ///
			coeflabels(glob_i ="Globalisation" europe_i ="European integration" immi_i = "Immigration" ecoopen_i = "Economic openness" redis_i = "Redistribution" civlib_i = "Civil liberties" cultlib1x = "Cultural liberalism") ///
			order(glob_i ecoopen_i europe_i immi_i) ///
			xline(0, lcolor(gs0) lwidth(thin)) xscale(range(-.4 .4)) xlabel(-.4  (.2) .4) bylabels("CDU/CSU" "FDP" "SPD" "Greens" "Left" "AfD" "Other party" "Don't know" "Will not vote") ///
			byopts(row(3)title("Model 2: Full model, including attitudes towards globalisation issues")) ///
			fysize(50) ///
			name(AMEs_vote_both, replace) 	
	
	* Combine graphs	
	graph combine AMEs_vote_onlyglob AMEs_vote_both, rows(3) xsize(4) iscale(*1.05) imargin(zero) 
	graph export FigureA5.pdf, replace	

*** Table A 12: Party approval model 1 (globalisation attitude only, without attitudes towards globalisation issues)
	use "DATA_stata.dta", clear
	
	*** Listwise deletion for the two models; keep observations constant (per party)
	global controls "ib8.pi c.age_indec##c.age_indec female i.educat i.incomecat east ecsit_ego1 ecsit_soc1"
	quietly reg glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x $controls 
	keep if e(sample)
	
	* Estimate model for each party
	foreach var in cdu9 csu9 fdp9 spd9 gru9 lin9 afd9 { 
	reg `var' glob_i redis_i civlib_i cultlib1x $controls
	estimates store `var'a
	}

	* Write Table A12
	esttab cdu9a csu9a fdp9a spd9a gru9a lin9a afd9a ///
	using TableA12.rtf, b(%8.2f) se(%8.2f) star(* 0.05 ** 0.01 *** 0.001) ar2 varwidth(20) nogaps compress ///
	coeflabels(ecoopen_i "Economic openness" ///
			   europe_i "European integration" ///
			   immi_i "Immigration" ///
			   glob_i "Globalisation" ///
			   redis_i "Redistribution" ///
			   civlib_i "Civil liberties" ///
			   cultlib1x "Cultural liberalism" ///
			   	1.pi "PI: CDU/CSU" ///
				2.pi "PI: FDP" ///
				3.pi "PI: SPD" ///
				4.pi "PI: Greens" ///
				5.pi "PI: The Left" ///
				6.pi "PI: AfD" ///
				7.pi "PI: Other party" ///
				ecsit_ego1 "Economic situation (ego)" ///
				ecsit_soc1 "Economic situation (country)" ///
				age_indec "Age/10" ///
				c.age_indec#c.age_indec "(Age/10)²" ///
				female "Female" ///
				1.educat "Education low" ///
				2.educat "Education medium" ///
				3.educat "Education high" ///
				1.incomecat "Income > 1000" ///
				2.incomecat "Income 1000-2000" ///
				3.incomecat "Income 2000-3000" ///
				4.incomecat "Income 3000-4000" ///
				5.incomecat "Income >4000" ///
				east "East Germany" ///				
				_cons "Constant") ///
	order(glob_i redis_i civlib_i cultlib1x) ///
	drop(8.pi 1.educat 1.incomecat) /// 
	mtitles(CDU	CSU	FDP	SPD	Greens Left AfD) nonumbers replace ///
	addnotes("Notes: Reported are unstandardized OLS coefficients with standard errors in parentheses; DV and IV range is 0-1 in all cases; reference categories: low education, income below 1000€, West Germany, no party identification.")

*** Table A 13: Party approval model 2 (full model, including attitudes towards globalisation issues) 
	* Estimate model for each party
	foreach var in cdu9 csu9 fdp9 spd9 gru9 lin9 afd9 { 
	reg `var' glob_i ecoopen_i europe_i immi_i redis_i civlib_i cultlib1x $controls
	estimates store `var'c
	}
	
	* Write Table A13
	esttab cdu9c csu9c fdp9c spd9c gru9c lin9c afd9c ///
	using TableA13.rtf, b(%8.2f) se(%8.2f) star(* 0.05 ** 0.01 *** 0.001) ar2 varwidth(20) nogaps compress ///
	coeflabels(ecoopen_i "Economic openness" ///
			   europe_i "European integration" ///
			   immi_i "Immigration" ///
			   glob_i "Globalisation" ///
			   redis_i "Redistribution" ///
			   civlib_i "Civil liberties" ///
			   cultlib1x "Cultural liberalism" ///
			   	1.pi "PI: CDU/CSU" ///
				2.pi "PI: FDP" ///
				3.pi "PI: SPD" ///
				4.pi "PI: Greens" ///
				5.pi "PI: The Left" ///
				6.pi "PI: AfD" ///
				7.pi "PI: Other party" ///
				ecsit_ego1 "Economic situation (ego)" ///
				ecsit_soc1 "Economic situation (country)" ///
				age_indec "Age/10" ///
				c.age_indec#c.age_indec "(Age/10)²" ///
				female "Female" ///
				1.educat "Education low" ///
				2.educat "Education medium" ///
				3.educat "Education high" ///
				1.incomecat "Income > 1000" ///
				2.incomecat "Income 1000-2000" ///
				3.incomecat "Income 2000-3000" ///
				4.incomecat "Income 3000-4000" ///
				5.incomecat "Income >4000" ///
				east "East Germany" ///				
				_cons "Constant") ///
	order(glob_i ecoopen_i europe_i immi_i  redis_i civlib_i cultlib1x) ///
	drop(8.pi 1.educat 1.incomecat) /// 
	mtitles(CDU	CSU	FDP	SPD	Greens Left AfD) nonumbers replace ///
	addnotes("Notes: Reported are unstandardized OLS coefficients with standard errors in parentheses; DV and IV range is 0-1 in all cases; reference categories: low education, income below 1000€, West Germany, no party identification.")
